const expressJoi = require('@escook/express-joi')
const express = require('express')

const router = express.Router()

//引入个人信息处理函数模块
const userinfoHandler = require('../router_handler/userinfo')
const { updateUserinfoRuler, updatepwdRuler, updateAvatarRuler } = require('../schema/userinfo')


//挂载和用户中心相关的路由

//获得用户信息
router.get('/userinfo', userinfoHandler.getUserinfo)

//更新用户信息
router.post('/userinfo', expressJoi(updateUserinfoRuler), userinfoHandler.updateUserInfo)

//重置密码
router.post('/updatepwd', expressJoi(updatepwdRuler), userinfoHandler.updatepwd)

//更换头像
router.post('/update/avatar', expressJoi(updateAvatarRuler), userinfoHandler.updateAvatar)


module.exports = router